</div><!--end middle-->
<div id="footer">
	<div class="footer_content">
	<p>Copyright &copy; 2012 <a href="http://www.qinlinggendiao.com/">www.qinlinggendiao.com</a>, All rights reserved. </p>
	<p> 秦岭根雕网, Designed by <a href="http://theui.net/">UITeam</a>.</p>
	</div>
</div><!--end footer-->
</div><!--end wrap-->
<script type="text/javascript"> /* 顶部时间显示 */
var now = new Object();
(function(){
	now = {
		t: <?php echo time()*1000; ?>,
		html: function(d){
			var str = d.getFullYear()+'年';
			str += ( d.getMonth()<9 ? ('0'+(d.getMonth()+1)) : (d.getMonth()+1) ) +'月';
			str += ( d.getDate()<10 ? ('0'+d.getDate()) : d.getDate() ) +'日 ';
			str += ( d.getHours()<10 ? ('0'+d.getHours()) : (d.getHours()) ) +':';
			str += ( d.getMinutes()<10 ? ('0'+d.getMinutes()) : (d.getMinutes()) ) +':';
			str += ( d.getSeconds()<10 ? ('0'+d.getSeconds()) : (d.getSeconds()) );
			return str;
		},
		show: function(){
			var d = new Date( this.t );
			document.getElementById('now').innerHTML = this.html(d);
			this.t += 1000;
			setTimeout('now.show()',1000); 			
		}
	}
	now.show();
})();
</script>
<script type="text/javascript" src="<?php $this->options->resUrl('js/jquery-1.8.1.min.js'); ?>"></script>
<script type="text/javascript" src="<?php $this->options->resUrl('js/jquery.cookie.js'); ?>"></script>
<script type="text/javascript" src="<?php $this->options->resUrl('js/jquery.lazyload.min.js'); ?>"></script>
<script type="text/javascript" src="<?php $this->options->resUrl('js/fancyBox/jquery.fancybox.pack.js'); ?>"></script>
<script type="text/javascript">
$(document).ready(function(){

<?php /************************************************************/
	/* 菜单添加 curren 样式 */
	if( $this->is('page') ){
		echo "\t$('.n_{$this->slug}').addClass('on');";
	}else if( $this->is('category', ___PROD___) ){
		echo "\t$('.n_product').addClass('on');" ;
	}else if( $this->is('tag') ){
		echo "\t$('.n_product').addClass('on');" ;
	}else if( $this->is('category', ___NEWS___) || $this->is('category', ___INFO___) ){
		echo "\t$('.n_news').addClass('on');" ;
	}else{
		echo "\t$('.n_index').addClass('on');" ;
	}
	echo PHP_EOL;
?>

<?php /************************************************************/
if( $this->is('index') || $this->is('page', 'index') ):  /* 首页效果 */ ?>
	/* slide box */
	(function(){  
		var c = $('.img').length;
		$('.img').lazyload();
		$('.s_show_pic').html('<a href="'+ $('.img').eq(0).attr('rel') +'"><img src="'+  $('.img').eq(0).attr('data-original') +'"/></a>');
		$('.s_show_tit').html('<a href="'+ $('.img').eq(0).attr('rel') +'" title="'+ $('.img').eq(0).attr('title') +'">'+ $('.img').eq(0).attr('title') +'</a>');
		$('.img').eq(0).css({opacity: 0.6});
		$('.img').eq(0).addClass('border');
		slide = {
			n:1, m:0,
			change: function(){
				n = this.n; m = this.m;
				var src = $('.img').eq(n).attr('data-original');
				var href = $('.img').eq(n).attr('rel');
				var title = $('.img').eq(n).attr('title');
				$('.img').eq(m).animate({opacity: 1}, 'slow');
				$('.img').removeClass('border');
				$('.img').eq(n).addClass('border');
				$('.s_show_pic').hide();
				$('.s_show_pic').html('<a href="'+ href +'"><img src="'+ src +'"/></a>');
				$('.s_show_tit, .s_show_mask').hide();
				$('.s_show_tit').html('<a href="'+ href +'" title="'+ title +'">'+ title +'</a>');
				$('.s_show_pic').fadeIn('slow');
				$('.s_show_tit, .s_show_mask').slideDown();
				$('.img').eq(n).animate({opacity: 0.6}, 200);
			},
			interval: function(){
				if(this.n==c){ this.n=0; this.m=c}else{this.m=this.n-1;}
				this.change(); this.n++;
			}
		};
		
		$('.img').bind({  /* images opacity */
			click: function(){
				$('.img').eq(slide.n-1).animate({opacity: 1}, 'slow')
				slide.n = $(this).attr('alt');
				clearInterval(t); slide.interval();
				t = setInterval('slide.interval()',3000);
			},
			mouseover:function(){
					$(this).animate({opacity:0.6}, 200);
			},
			mouseout: function(){
				if( $(this).attr('alt') != (slide.n-1) ){
					$(this).animate({opacity:1}, 'slow');
				}
			}
		});
		
		$('.s_show_tit').bind({  /* title animations */
			mouseover: function(){ clearInterval(t); },
			mouseout: function(){ t = setInterval('slide.interval()',3000); }
		});
		var t = setInterval('slide.interval()',3000);
	})();
	
	/* content */
	$('.about').bind({
		mouseover: function(){ $(this).animate({ width: '960px' }); },
		mouseleave: function(){ $(this).animate({ width: '308px' }); }
	});
	
	/* links */
	$('.links_nav a').bind({
		mouseover: function(){
			$('.links_nav a').removeClass('on');
			$('.links_div').hide();
			$(this).addClass('on');
			$('.links_div').eq($(this).attr('rel')).show();
		}
	});
<?php endif; ?>

<?php /************************************************************/
if( $this->is('category', ___PROD___) || $this->is('tag') ): /* 保存侧边栏状态 */ ?>
	if( $.cookie('close_sidebar') == 'close_sidebar' ){ $('.sidebar').hide(); $('.main').css({width:'100%'}); }
	$('.c_btn').bind({
		click: function(){
			$(".sidebar").slideToggle();
			if( $(".main").width() == 720 ){
				$.cookie('close_sidebar', 'close_sidebar', { expires: 365, path: '/' });
				$(".main").animate({width:'100%'});			
			}else{
				$.removeCookie('close_sidebar', { path: '/' });
				$(".main").animate({width:'720px'});
			}
		}
	});
<?php endif; ?>

	/* adjust the height */
	if( $('#middle').height()<700 ){ $('#middle').css({height:'700px'}); }
});
</script>

<?php /************************************************************/
if( $this->is('post') && $this->category == ___PROD___ ) : /* 产品详情页 */  ?>
<script type="text/javascript">
$(document).ready(function(){
	function btnClick(obj){
		var n = obj.attr('rel');
		$('.post_tab a').removeClass('on');
		obj.addClass('on');
		$('.post_div_a, .post_div_b, .post_div_c, .post_div_d').hide();
		$('.post_div_'+n).slideDown();
	}
	if(location.hash=='#pro_detail'){
		btnClick($('.btn_detail'));
	}else if(location.hash=='#pro_comment'){
		btnClick($('.btn_comment'));
	}else if(location.hash=='#pro_order'){
		btnClick($('.btn_order'));
	}
	$('.post_tab a').bind({
		click: function(){ btnClick($(this)); }
	});
	$('#pre_pic_btn').bind({
		click: function(){ btnClick($('.btn_pics')); }
	});
	$('#post_pics').css({height: '480px'});
	
	/** order */
	$('#in_submit_order').click(function(){
		if( $('#in_name').val()=="" ){
			alert('姓名不能为空！');
			return false;
		}
		if( $('#in_tel').val()=="" ){
			alert('电话不能为空！');
			return false;
		}
		if( $('#in_add').val()=="" ){
			alert('请填写地址！');
			return false;
		}
		if( $('#in_mail').val()=="" ){
			alert('邮箱不能为空！');
			return false;
		}
		
		$.ajax({
			url: '<?php $this->options->index('action/contents-order-edit?do=submit');?>',
			type: 'POST',
			dataType: 'json',
			data: {
				name: $('#in_name').val(), tel: $('#in_tel').val(), add: $('#in_add').val(), mail: $('#in_mail').val(),
				cid: <?php $this->cid();?>
			},
			success: function(d){
				if(d.s==0){
					alert(d.info);
				}else{
					alert(d.info);
					location.href="<?php $this->options->index('index.php');?>";
				}
			}
		})
	});
	
});
</script>
<script type="text/javascript" src="<?php $this->options->resUrl('js/jquery.galleria-1.2.8.min.js'); ?>"></script>
<script type="text/javascript">
$(document).ready(function(){
	if( $.browser.msie && $.browser.version =='6.0'){
		$('#post_pics a').fancybox();
	}else{
		var galleriaTheme = '<?php $this->options->resUrl('js/galleria/galleria.classic.min.js');?>';
		Galleria.loadTheme(galleriaTheme);
		Galleria.run('#post_pics', {
			transition: 'fade',
			imageCrop: false,
			autoplay: 5000
		});

		$('.galleria-images .galleria-image img').click(function(){ 
				$.fancybox.open($(this).attr('src'));
		});
	}
});
</script>
<?php endif; ?>
</body>
</html>